	<style type="text/css">	
	div.thumb {
		float:left;
	}
	div.caption {
		padding-left:5px;
		font-size:10px;
	}
    .kich{
        border: 1px solid #cacaca;
        padding:2px;
        width:100px;
        text-align:center;
        background-color: #9C9AF9;
        color:#fff;
        cursor: pointer;
        
    }
    .rev{
        border: 1px solid #cacaca;
        padding:2px;
        width:100px;
        text-align:center;
        background-color: #FF0224;
        color:#fff;
        cursor: pointer;
        
    }
    .tab_sp{
        width:100%;
        float:left;
    }
    .tab_sp ul{
        margin:2px;
        list-style-type: none;
    }
    .tab_sp ul li{
        margin:10px;
        float:left;  
       
            
    }
    .tab_sp ul li a{
        margin:10px;
        border:1px solid #cacaca;
        padding:4px;
        background-color: #D8C9C9;
            
    }
    .tab_sp ul li .active{        
        background-color: #FFC526;
    }
    .tabDetails{
        width:100%;
        float:left;
    }
    #noidungtab{
        width:90%;
        border:1px solid #cacaca;
        padding:10px;
        text-align:left;
    }
    #noidungtab ul{
        list-style: none;
    }
	</style>
    <!--tab-->
    <script type="text/javascript">
	$(document).ready(function(){
		$(".tabContents").hide(); // Ẩn toàn bộ nội dung của tab
		$(".tabContents:first").show(); // Mặc định sẽ hiển thị tab1		
		$(".tab_sp ul li a").click(function(){ //Khai báo sự kiện khi click vào một tab nào đó			
			var activeTab = '#'+$(this).attr("href"); 
			$(".tab_sp ul li a").removeClass("active"); 
			$(this).addClass("active"); 
			$(".tabContents").hide(); 
			$(activeTab).fadeIn(); 
            return false;
		});
	});
</script>
<!--end tab-->
	<script type="text/javascript">

            function BrowseServer( startupPath, functionData )
            {
            	// You can use the "CKFinder" class to render CKFinder in a page:
            	var finder = new CKFinder();
            
            	// The path for the installation of CKFinder (default = "/ckfinder/").
            	finder.basePath = '../';
            
            	//Startup path in a form: "Type:/path/to/directory/"
            	finder.startupPath = startupPath;
            
            	// Name of a function which is called when a file is selected in CKFinder.
            	finder.selectActionFunction = SetFileField;
            
            	// Additional data to be passed to the selectActionFunction in a second argument.
            	// We'll use this feature to pass the Id of a field that will be updated.
            	finder.selectActionData = functionData;
            
            	// Name of a function which is called when a thumbnail is selected in CKFinder.
            	finder.selectThumbnailActionFunction = ShowThumbnails;
            
            	// Launch CKFinder
            	finder.popup();
            }
            
            // This is a sample function which is called when a file is selected in CKFinder.
            function SetFileField( fileUrl, data )
            {
            	document.getElementById( data["selectActionData"] ).value = fileUrl;
            }
            
            // This is a sample function which is called when a thumbnail is selected in CKFinder.
            function ShowThumbnails( fileUrl, data )
            {
            	// this = CKFinderAPI
            	var sFileName = this.getSelectedFile().name;
            	document.getElementById( 'thumbnails' ).innerHTML +=
            			'<div class="thumb">' +
            				'<img src="' + fileUrl + '" />' +
            				'<div class="caption">' +
            					'<a href="' + data["fileUrl"] + '" target="_blank">' + sFileName + '</a> (' + data["fileSize"] + 'KB)' +
            				'</div>' +
            			'</div>';
            
            	document.getElementById( 'preview' ).style.display = "";
            	// It is not required to return any value.
            	// When false is returned, CKFinder will not close automatically.
            	return false;
            }
	</script>
<!-- sua bai viet-->
<!-- script add them hinh anh-->	
<script>
var ii=1;
$(document).ready(function(){
   $('.kich').click(function(){    
    var insert = '<p><input id="xFilePath'+ii+'" name="image[]" type="text" size="60" /><input type="button" value="Tải lên" onclick="BrowseServer( \'Files:/\', \'xFilePath'+ii+'\' );" /><span class="rev">Xóa</span></p>';
    $(insert).appendTo('.inner');
    ii++;
   })
    $('.rev').live('click', function() { 
    $(this).parents('p').remove();    
   })
    
})

</script>
<!-- end script add them hinh anh-->
<?php echo validation_errors(); ?>

<form method="POST" action="<?php echo base_url().'admin/xuly/product/list/'.$this->uri->segment(5);?>">
    <div class="box_heading">
        <div class="icon">
        <img src="<?php echo base_url().'skin/admin/images/icon_settings.png';?>"/> Sản phẩm ( <span style="color: red;"> * : không được để trống</span> )  <?php if(!empty($thongbao)){echo '<img src='.base_url().'skin/admin/images/ok.png class="ok"><font color=red><b>'.$thongbao.'</b></font>';}?>
        </div>
        <div class="right">    
        <a href="<?php echo base_url().'admin/xuly/product';?>">Hủy</a>
        </div>
    </div>
    
    <div class="box_noidung">
        <table class="form">
            <tr><td><font color=red>* </font>Tiêu đề</td><td><input type="text" size="40" value="<?php if(!empty($data)){echo $data->title;};?>" name="title"/></td></tr>
            <tr><td><font color=red>* </font> Alias</td><td><input type="text" size="40" value="<?php if(!empty($data)){echo $data->alias;};?>" name="alias"/>(Alias sẽ hiển thị trên url trình duyệt)</td></tr>
            
            <tr><td><font color=red>* </font> Mã sản phẩm</td><td><input type="text" size="40" value="<?php if(!empty($data)){echo $data->code;};?>" name="code"/></td></tr>
            
            <tr><td><font color=red>* </font>Giá sản phẩm (VND)</td><td><input type="text" size="40" value="<?php if(!empty($data)){echo $data->price;};?>" name="price"/></td></tr>
            <tr><td><font color=red>* </font>Thời gian bảo hành</td><td><input type="text" size="40" value="<?php if(!empty($data)){echo $data->tgbaohanh;};?>" name="tgbaohanh"/></td></tr>
            
            <tr><td><font color=red>* </font>Danh mục</td><td>
                <select name="category">    
                <?php if($cat) {foreach ( $cat as $cat ){
                  echo '<option '; 
                  if(!empty($data)){if( $cat->id==$data->category )echo ' selected="selected" ';}
                  echo ' value='.$cat->id. '>'.$cat->title.'</option>';
                }}?>                                  
                   
                  
                </select> 
                </td></tr>
                
                <tr><td><font color=red>* </font>Hãng sản xuất</td><td>
                <select name="factory">    
                <?php 
                $manufacturer = $this->Admin_model->get_data('product_manufacturer');
                if($manufacturer) {foreach ( $manufacturer as $mn ){
                  echo '<option '; 
                  if(!empty($data)){if( $mn->id==$data->factory )echo ' selected="selected" ';}
                  echo ' value='.$mn->id. '>'.$mn->title.'</option>';
                }}?>                                  
                   
                  
                </select> 
                </td></tr>
                
            <tr><td><font color=red>* </font>Trạng thái</td><td>
                <select name="publish">                                            
                  <option <?php if(!empty($data)){if($data->publish=='1')echo 'selected="selected"';} ?> value='1'>Hiện</option>';
                  <option <?php if(!empty($data)){if($data->publish=='0')echo 'selected="selected"';} ?> value='0'>Ẩn</option>';                                              
                </select> 
                </td></tr>
            
            <tr><td><font color=red>* </font>Ảnh sản phẩm</td><td> 
                            <p>
                                <input id="xFile" name="img" type="text" size="60" value="<?php if(!empty($data)){echo $data->img;};?>" />
                                <input type="button" value="Tải lên" onclick="BrowseServer( 'Files:/', 'xFile' );" />
                                <img src="<?php if(!empty($data)){echo $data->img;};?>" width=20px height=20px/>
                            </p>
            
            </td></tr>
            <tr><td></font>Meta Description</td><td><textarea rows="2" cols="40" name="metades"><?php if(!empty($data)){echo $data->metades;};?></textarea></td></tr>
            <tr><td></font>Meta Keywords</td><td><textarea rows="2" cols="40" name="metakey"><?php if(!empty($data)){echo $data->metakey;};?></textarea></td></tr>
            
      
           
           <!--tab-->          
           <tr><td style="text-align: center;" colspan="2">
           
           
               
               <div class="tab_sp">                    
                        <ul>
                            <li><a class="active" href="tab1">Miêu tả sản</a></li>
                            <li><a href="tab2">Thông số kỹ thuật</a></li>
                            <li><a href="tab3">Bảo hành</a></li>                                                       
                        </ul>
                    
                    </div>
                <div class="tabDetails">
                    	<div id="tab1" class="tabContents">
                        	<textarea rows="5" cols="40" name="description" id="soanthao"><?php if(!empty($data)){echo $data->description;};?></textarea>
                        </div>
                        
                		<div id="tab2" class="tabContents">
                            <textarea rows="5" cols="40" name="fulltext" id="soanthao2"><?php if(!empty($data)){echo $data->fulltext;};?></textarea>
                        </div>
                        
                		<div id="tab3" class="tabContents">
                            <textarea rows="5" cols="40" name="baohanh" id="soanthao3"><?php if(!empty($data)){echo $data->baohanh;};?></textarea>
                        </div>	
                       	
                        
                    </div>
           </td></tr>
           <!--end tab-->
           <tr><td> Nổi bật</td><td>
            <input type="checkbox" name="noibat" value="1" <?php if(!empty($data)){echo $data->noibat==1?' checked':'';}?> >
            </td></tr>
            
            <tr><td> Bán chạy</td><td>
            <input type="checkbox" name="banchay" value="1" <?php if(!empty($data)){echo $data->banchay==1?' checked':'';}?> >
            </td></tr>
            
            <tr><td> Tiêu biểu</td><td>
            <input type="checkbox" name="tieubieu" value="1" <?php if(!empty($data)){echo $data->tieubieu==1?' checked':'';}?> >
            </td></tr>
            
            <tr><td> Thứ tự</td><td><input type="text" size="40" value="<?php if(!empty($data)){echo $data->order;}else echo '0';?>" name="order"/></td></tr>
            <tr><td style="text-align: center;" colspan="2"><input class="guidulieu" type="submit" value="Lưu"/></td></tr>
        </table>
    </div>
</form>
    <script type="text/javascript">
       if ( typeof CKEDITOR == 'undefined' ){
        	document.write("khong") ;
        }
        else{
        	var editor = CKEDITOR.replace( 'soanthao' );  
            var editor2 = CKEDITOR.replace( 'soanthao2' ); 
            var editor3 = CKEDITOR.replace( 'soanthao3' );            
            CKFinder.setupCKEditor( editor, '<?php echo base_url();?>ckeditor/ckfinder/' ) ;  
            CKFinder.setupCKEditor( editor2, '<?php echo base_url();?>ckeditor/ckfinder/' ) ; 
            CKFinder.setupCKEditor( editor3, '<?php echo base_url();?>ckeditor/ckfinder/' ) ;  
                            	
        }
    </script>
<!--end sua bai viet-->